home *** CD-ROM | disk | FTP | other *** search
/ D.I.S.C. 6 / D.I.S.C. 6.adf / sources / sinus2.s < prev   
Text File  |  1987-05-04  |  11KB  |  374 lines

  1. ; ------------ Sinscroller -------------
  2. ; For the CJ Assembler Lesson
  3. ; (c) 1990 Doctor Mabuse
  4. ; the Alpha Flight
  5. ; (o) 1990 (optimized 1990) by D.I.S.C - Coders
  6. ; (e) English corrected by D.I.S.C. - editors
  7. ; --------- Important Infos !! ---------
  8. ; As usual get the font calles "data"            ; called
  9. ; with the -y- command. As you can see,
  10. ; the routine is preset as a two pixel
  11. ; sinus scroller. It's no problem to
  12. ; change it into a one pixel profi-
  13. ; scroller but beware of the raster.
  14. ; The flickering green shows where the
  15. ; raster line has arrived when the
  16. ; routine has fnished. When it's at the            ; finished
  17. ; bottom of the screen you have lost.
  18. ; To remove it look for the move in the
  19. ; interrupt.
  20. ; For changing into a 1 or 4 pixel
  21. ; sinus (depending on the available
  22. ; raster time) look for the marked
  23. ; positions in the routine. You must
  24. ; change the blitter mask and at a 
  25. ; second place the shift value of
  26. ; the blitter mask. When you make a
  27. ; One pixel sinus or even with a two
  28. ; pixel one you will notice that the
  29. ; scroller is scrambled at the right
  30. ; end. In this case the routine didn't            ; didn't-hasn't
  31. ; already finished when the raster line
  32. ; reached this point. To avoid it you
  33. ; must work with double buffering. Make
  34. ; two screens. One for blitting and the
  35. ; other for beeing displayed. Every            ; being
  36. ; interupt you swap them, it's very
  37. ; easy. Also you must make a longer
  38. ; sinus wave. The sinus is peridically            ; periodical
  39. ; and you must add another 256 degree
  40. ; turn for the new 160 positions.
  41. ; Try it and good luck!
  42. ;            Yours         DRM
  43. ; ------------- Nachladen --------------
  44. >extern "data7",$60000
  45. jmp        $50000
  46. org        $50000
  47. load        $50000
  48. ; -------------- Offsets ---------------
  49. vbeampos=    -384
  50. openlibrary=     -408
  51. closelibrary=     -414
  52. forbid=     -132
  53. permit=     -138
  54. execbase=     $04
  55. ; --------------------------------------
  56. start:
  57. movem.l     d0-d7/a0-a6,-(a7)    ; Save registers
  58. ; --------------------------------------
  59. ; ------- Graphics Libary oeffnen ------
  60. move.l        execbase,a6
  61. lea        gfxname,a1     
  62. jsr        openlibrary(a6)
  63. beq        end
  64. move.l        d0,gfxbase
  65. ; -------- Prepare Sinus Table ---------
  66. lea        sin(pc),a0
  67. ll:
  68. move.w        (a0),d1
  69. muls        #30,d1            ; Amplitude of the sinus wave!!
  70. asr.l        #8,d1
  71. muls        #44,d1
  72. add.l        #$61000+[140*44],d1    ; Middle line of sinus wave
  73. move.w        d1,(a0)+
  74. cmp.l        #send,a0
  75. bne.s        ll
  76. ; ----------- Clear screen -------------
  77. moveq        #10,d1
  78. sy:
  79. lea        $60fd0,a0
  80. move.w        #$1000,d0
  81. sz:
  82. clr.l        (a0)+
  83. dbf        d0,sz
  84. dbf        d1,sy
  85. ; --------------------------------------
  86. move.l        execbase,a6
  87. jsr        forbid(a6)
  88. ; ---- Eigene Copperliste einsetzen ----
  89. move.l        gfxbase(pc),a0
  90. lea        $32(a0),a0
  91. lea        $dff000,a5
  92. move.l        #0,$40(a5)
  93. move.w        #$0080,$96(a5)
  94. move.l        (a0),oldcopper
  95. move.l        #newcopper,(a0)
  96. move.w        #$8080,$96(a5)
  97. ; --------- Change IRQ vector ----------
  98. move.l        $6c,oldirq
  99. move.l        #newirq,$6c
  100. ; ------- Main program Waitloop --------
  101. main:
  102. btst        #6,$bfe001
  103. bne.s        main
  104. ; --------------------------------------
  105. move.l        oldirq(pc),$6c
  106. ; --------- close GFX-Library ----------
  107. move.l        execbase,a6
  108. move.l        gfxbase,a1
  109. jsr        closelibrary(a6)
  110. ; ----- write old Copperlist back  -----
  111. move.l        gfxbase(pc),a0
  112. lea        $32(a0),a0
  113. move.w        #$0080,$96(a5)
  114. move.l        oldcopper(pc),(a0)
  115. move.w        #$8080,$96(a5)
  116. ; ------ reactiveate Multitasking ------
  117. move.l        execbase,a6
  118. jsr        permit(a6)
  119. ; --------------- Exit -----------------
  120. movem.l        (a7)+,d0-d7/a0-a6
  121. end:
  122. rts
  123. ; --------------------------------------
  124. ; --------------------------------------
  125. newirq:                    ; Our interrupt
  126. movem.l        d0-d7/a0-a6,-(sp)    ; Save registers
  127. moveq        #2,d5
  128. moveq        #6,d6
  129. ; --------------------------------------
  130. cmp.b        #$7f,$bfec01        ; Check space key
  131. beq        i0
  132. bsr.s        ppppp1
  133. i0:
  134. bsr        copy
  135. move.w        #$320,$180(a5)        ; Set backgroundcolour. Remove
  136.                     ; when you want it. It shows when
  137.                     ; the blitterroutine has
  138.                     ; finished. When this mark comes
  139.                     ; into the area of the sinus
  140.                     ; this will be spoiled. Then you
  141.                     ; must use double buffering.
  142. ; --------------------------------------
  143. movem.l        (sp)+,d0-d7/a0-a6    ; IRQ End
  144. dc.w        $4ef9
  145. oldirq:
  146. dc.l        0
  147. ; --------------------------------------
  148. ppppp1:
  149. move.l        #$61000,$50(a5)
  150. move.l        #$60ffe,$54(a5)
  151. clr.l        $64(a5)
  152. move.l        #$ffff0fff,$44(a5)
  153. move.w        #$e9f0,$40(a5)
  154. move.w        #[14*1]*64+$16,$58(a5)
  155. ; --------------------------------------
  156. add.w        d5,srr
  157. cmpi.w        #18,srr
  158. bcs.s        no
  159. clr.w        srr
  160. bsr.s        print1            ; neues zeichen ausgeben
  161. no:
  162. rts
  163. srr:    dc.w    0
  164. sxx:    dc.l    msg
  165. ; --------------------------------------
  166. print1:
  167. moveq        #0,d0
  168. moveq        #0,d1
  169. move.l        sxx(pc),a0
  170. move.b        (a0),d0
  171. sub.b        #32,d0
  172. bpl.s        nnm
  173. moveq        #16,d0
  174. nnm:
  175. move.b        d0,d1
  176. divu        #20,d1
  177. move.w        d1,d2
  178. swap        d1
  179. move.w        d1,d3
  180. add.w        d3,d3
  181. mulu        #14*40,d2
  182. add.w        d2,d3
  183. moveq        #6,d0
  184. swap        d0
  185. add.w        d3,d0
  186. move.l        d0,$50(a5)
  187. move.l        #$61028,$54(a5)        ; Blit Source
  188. move.l        #$0026002a,$64(a5)    ; Modulo
  189. move.w        #$ffff,$46(a5)        ; Maske
  190. move.w        #$09f0,$40(a5)        ; Modus
  191. move.w        #13*1,d0        ; Hoehe
  192. asl.w        d6,d0
  193. addq.w        #1,d0            ; Breite
  194. move.w        d0,$58(a5)        ; Start
  195. addq.l        #1,sxx            ; naechstes Zeichen
  196. cmp.l        #ende,sxx
  197. bcs.s        eee
  198. move.l        #msg,sxx
  199. eee:
  200. rts
  201. ; ----------- Sinuskopieren ------------
  202. copy:
  203.                     ; Clear sinus area. Take care
  204. move.l    #$61000+[108*44],$54(a5)    ; that you clear the right
  205. move.l    #$00040004,$64(a5)        ; area. And clear enought but
  206. move.l    #$0000ffff,$44(a5)        ; not more than necessary.
  207. move.l    #$01000000,$40(a5)
  208. move.w    #[76*1]*64+$14,$58(a5)        ; Size of clearing
  209. ; --------------------------------------
  210. addq.w        #3,cx            ; This counter lets your sinus
  211. cmpi.w        #256*2,cx        ; wave move with the set speed
  212. bcs.s        cno
  213. clr.w        cx
  214. cno:
  215. move.l        #$61000,d1
  216. moveq        #$6,d3
  217. swap        d3
  218. moveq        #0,d4
  219. lea        sin(pc),a0
  220. move.w        cx(pc),d0
  221. and        #$fffe,d0
  222. lea        (a0,d0.w),a0
  223. clend:                    ; Wait
  224. btst        d6,$dff002
  225. bne.s        clend
  226. move.l        #$002a002a,$60(a5)    ; Modulo Values for Blitter
  227. move.l        #$002a002a,$64(a5)
  228. move.w        #-1,$46(a5)        ; Second Mask Word must be filled
  229. move.l        #$0b5a0000,$40(a5)
  230.  
  231. move.w        #13*64+1,d0
  232. lea        $50(a5),a1
  233. lea        $48(a5),a2
  234. lea        $54(a5),a3
  235. lea        $44(a5),a4
  236. lea        $58(a5),a6
  237. cn1:                    ; Extern loop: For getting all
  238.                     ; 20 words of one line
  239. move.w        #$c000,d2        ; Set blit mask. For one (four)
  240.                     ; pixel sinus set to $8000
  241.                     ; ($f000)
  242. cn2:                    ; Intern loop: Copies from your
  243.                     ; word one, two or four bits
  244.                     ; together in 16, 8 or 4 steps.
  245.  
  246. move.w        (a0),d3            ; Endadress of Sinus List
  247. add.w        d4,d3
  248. move.l        d1,(a1)            ; A
  249. move.l        d3,(a2)            ; C
  250. move.l        d3,(a3)            ; D
  251. move.w        d2,(a4)            ; Set Mask
  252. move.w        d0,(a6)
  253.  
  254. lea        (a0,d5.w),a0
  255. lsr.w        d5,d2            ; Shift Blitter mask left for
  256.                     ; copying the other bits of
  257.                     ; this word. For one (four)
  258.                     ; pixel scroller set to 1 (4)!
  259. bne        cn2
  260. add.l        d5,d1
  261. add.l        d5,d4
  262. cmpi.l        #$28,d4
  263. bne.s        cn1
  264. rts
  265. ; ---------------- Datas ---------------
  266. cx:    dc.w    0
  267. sin:                    ; Sinusnumbers. This sinus table
  268.                     ; has 256 degrees. Important! In
  269.                     ; the Init part a routine 
  270.                     ; multiplicates a values with
  271.                     ; the size of one screen line
  272.                     ; and adds the base adress!!!!
  273. DC.W    $0100,$0100,$0100,$00FF,$00FF,$00FE,$00FD,$00FC
  274. DC.W    $00FB,$00FA,$00F8,$00F7,$00F5,$00F3,$00F1,$00EF
  275. DC.W    $00ED,$00EA,$00E7,$00E5,$00E2,$00DF,$00DC,$00D8
  276. DC.W    $00D5,$00D1,$00CE,$00CA,$00C6,$00C2,$00BE,$00B9
  277. DC.W    $00B5,$00B1,$00AC,$00A7,$00A2,$009D,$0098,$0093
  278. DC.W    $008E,$0089,$0084,$007E,$0079,$0073,$006D,$0068
  279. DC.W    $0062,$005C,$0056,$0050,$004A,$0044,$003E,$0038
  280. DC.W    $0032,$002C,$0026,$001F,$0019,$0013,$000D,$0006
  281. DC.W    $0000,$FFFA,$FFF3,$FFED,$FFE7,$FFE1,$FFDA,$FFD4
  282. DC.W    $FFCE,$FFC8,$FFC2,$FFBC,$FFB6,$FFB0,$FFAA,$FFA4
  283. DC.W    $FF9E,$FF98,$FF93,$FF8D,$FF87,$FF82,$FF7C,$FF77
  284. DC.W    $FF72,$FF6D,$FF67,$FF62,$FF5E,$FF59,$FF54,$FF4F
  285. DC.W    $FF4B,$FF47,$FF42,$FF3E,$FF3A,$FF36,$FF32,$FF2F
  286. DC.W    $FF2B,$FF28,$FF24,$FF21,$FF1E,$FF1B,$FF19,$FF16
  287. DC.W    $FF13,$FF11,$FF0F,$FF0D,$FF0B,$FF09,$FF08,$FF06
  288. DC.W    $FF05,$FF04,$FF03,$FF02,$FF01,$FF01,$FF00,$FF00
  289. DC.W    $FF00,$FF00,$FF00,$FF01,$FF01,$FF02,$FF03,$FF04
  290. DC.W    $FF05,$FF06,$FF08,$FF09,$FF0B,$FF0D,$FF0F,$FF11
  291. DC.W    $FF13,$FF16,$FF19,$FF1B,$FF1E,$FF21,$FF24,$FF28
  292. DC.W    $FF2B,$FF2F,$FF32,$FF36,$FF3A,$FF3E,$FF42,$FF47
  293. DC.W    $FF4B,$FF4F,$FF54,$FF59,$FF5E,$FF63,$FF68,$FF6D
  294. DC.W    $FF72,$FF77,$FF7C,$FF82,$FF87,$FF8D,$FF93,$FF98
  295. DC.W    $FF9E,$FFA4,$FFAA,$FFB0,$FFB6,$FFBC,$FFC2,$FFC8
  296. DC.W    $FFCE,$FFD4,$FFDA,$FFE1,$FFE7,$FFED,$FFF3,$FFFA
  297. DC.W    $0000,$0006,$000D,$0013,$0019,$001F,$0026,$002C
  298. DC.W    $0032,$0038,$003E,$0044,$004A,$0050,$0056,$005C
  299. DC.W    $0062,$0068,$006D,$0073,$0079,$007E,$0084,$0089
  300. DC.W    $008E,$0093,$0099,$009E,$00A2,$00A7,$00AC,$00B1
  301. DC.W    $00B5,$00B9,$00BE,$00C2,$00C6,$00CA,$00CE,$00D1
  302. DC.W    $00D5,$00D8,$00DC,$00DF,$00E2,$00E5,$00E7,$00EA
  303. DC.W    $00ED,$00EF,$00F1,$00F3,$00F5,$00F7,$00F8,$00FA
  304. DC.W    $00FB,$00FC,$00FD,$00FE,$00FF,$00FF,$0100,$0100
  305. DC.W    $0100,$0100,$0100,$00FF,$00FF,$00FE,$00FD,$00FC
  306. DC.W    $00FB,$00FA,$00F8,$00F7,$00F5,$00F3,$00F1,$00EF
  307. DC.W    $00ED,$00EA,$00E7,$00E5,$00E2,$00DF,$00DC,$00D8
  308. DC.W    $00D5,$00D1,$00CE,$00CA,$00C6,$00C2,$00BE,$00B9
  309. DC.W    $00B5,$00B1,$00AC,$00A7,$00A2,$009D,$0098,$0093
  310. DC.W    $008E,$0089,$0084,$007E,$0079,$0073,$006D,$0068
  311. DC.W    $0062,$005C,$0056,$0050,$004A,$0044,$003E,$0038
  312. DC.W    $0032,$002C,$0026,$001F,$0019,$0013,$000D,$0006
  313. DC.W    $0000,$FFFA,$FFF3,$FFED,$FFE7,$FFE1,$FFDA,$FFD4
  314. DC.W    $FFCE,$FFC8,$FFC2,$FFBC,$FFB6,$FFB0,$FFAA,$FFA4
  315. DC.W    $FF9E,$FF98,$FF93,$FF8D,$FF87,$FF82,$FF7C,$FF77
  316. DC.W    $FF72,$FF6D,$FF67,$FF62,$FF5E,$FF59,$FF54,$FF4F
  317. DC.W    $FF4B,$FF47,$FF42,$FF3E,$FF3A,$FF36,$FF32,$FF2F
  318. DC.W    $FF2B,$FF28,$FF24,$FF21,$FF1E,$FF1B,$FF19,$FF16
  319. DC.W    $FF13,$FF11,$FF0F,$FF0D,$FF0B,$FF09,$FF08,$FF06
  320. DC.W    $FF05,$FF04,$FF03,$FF02,$FF01,$FF01,$FF00,$FF00
  321. DC.W    $FF00,$FF00,$FF00,$FF01,$FF01,$FF02,$FF03,$FF04
  322. DC.W    $FF05,$FF06,$FF08,$FF09,$FF0B,$FF0D,$FF0F,$FF11
  323. DC.W    $FF13,$FF16,$FF19,$FF1B,$FF1E,$FF21,$FF24,$FF28
  324. DC.W    $FF2B,$FF2F,$FF32,$FF36,$FF3A,$FF3E,$FF42,$FF47
  325. DC.W    $FF4B,$FF4F,$FF54,$FF59,$FF5E,$FF63,$FF68,$FF6D
  326. DC.W    $FF72,$FF77,$FF7C,$FF82,$FF87,$FF8D,$FF93,$FF98
  327. DC.W    $FF9E,$FFA4,$FFAA,$FFB0,$FFB6,$FFBC,$FFC2,$FFC8
  328. DC.W    $FFCE,$FFD4,$FFDA,$FFE1,$FFE7,$FFED,$FFF3,$FFFA
  329. DC.W    $0000,$0006,$000D,$0013,$0019,$001F,$0026,$002C
  330. DC.W    $0032,$0038,$003E,$0044,$004A,$0050,$0056,$005C
  331. DC.W    $0062,$0068,$006D,$0073,$0079,$007E,$0084,$0089
  332. DC.W    $008E,$0093,$0099,$009E,$00A2,$00A7,$00AC,$00B1
  333. DC.W    $00B5,$00B9,$00BE,$00C2,$00C6,$00CA,$00CE,$00D1
  334. DC.W    $00D5,$00D8,$00DC,$00DF,$00E2,$00E5,$00E7,$00EA
  335. DC.W    $00ED,$00EF,$00F1,$00F3,$00F5,$00F7,$00F8,$00FA
  336. DC.W    $00FB,$00FC,$00FD,$00FE,$00FF,$00FF,$0100,$0100
  337. send:
  338. ; ------------ Copperliste -------------
  339. newcopper:
  340. dc.w     $008e,$2881,$0090,$28c1 ; Bildschirmgrenzen 
  341. dc.w     $0092,$0038,$0094,$00d0 ; DataFetch Start/Stop
  342. dc.w     $0108,$0004,$010a,$0004    ; Modulos
  343. dc.w     $0102,$0001,$0104,$0040 ; Control Reg. #1 u. #2
  344. dc.w     $0100,$2200        ; Control Reg. #0
  345.  
  346. dc.w    $00e0,$0006,$00e2,$1000-44
  347. dc.w    $00e4,$0006,$00e6,$1000
  348.  
  349. dc.w    $0180,$0211,$0182,$0980
  350. dc.w    $0184,$0ff0,$0186,$0cb0
  351. dc.w    $0188,$0ddd,$018a,$0bbb
  352. dc.w    $018c,$0999,$018e,$0866
  353.  
  354. dc.w    $0120,$0000,$0122,$0000
  355. dc.w    $0128,$0000,$012a,$0000
  356. dc.w    $0130,$0000,$0132,$0000
  357. dc.w    $0138,$0000,$013a,$0000
  358.  
  359. dc.w    $ffff,$fffe
  360. ; ------------- Scrolltext -------------
  361. msg:
  362. DC.B    "ALPHA FLIGHT PROUDLY PRESENTS ---       "
  363. DC.B    "A MEGA PRODUCTION FROM DOCTOR MABUSE.   "
  364. DC.B    "THE UNBEATABLE CODER  JEAH!!! "
  365. dc.b    'OPTIMIZED BY THE D.I.S.C - TEAM !!! '
  366. ende:
  367. even
  368. ; ---------- Systemregister ------------
  369. gfxbase:    dc.l     0
  370. oldcopper:    dc.l    0
  371. gfxname:
  372. dc.b     "graphics.library",0,0
  373. ; ------ Pointer der Scrollroutine -----
  374.